package charts; 

import charts.series.Element;
import charts.series.bars.ECandle;
import charts.Structs.StyleStruct;

import string.Utils;



class Candle extends BarBase<StyleStruct, ECandle> {

	public function new( json:Dynamic, group:Float ) {
		super( json, group );
	}
	
	//
	// called from the base object
	//
	override function get_element( index:Float, value:Dynamic ): ECandle {
		
		
		var default_style:Style = {
				colour:		this.style.colour,
				tip:		this.style.tip,
				alpha:      this.style.alpha
		};
		
		if( Std.is( value, Float) )
			default_style.top = value;
		else
			Object_helper.merge_2( value, default_style );
			
		// our parent colour is a number, but
		// we may have our own colour:
		if( Std.is( default_style.colour, String) )
			default_style.colour = Utils.get_colour( default_style.colour );
			
		// Tr.ace_json(default_style);
		
		return new ECandle( index, default_style, this.group );
	}
}
